home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / perl5000.zip / perl5000 / t / op / write.t < prev   
Encoding:
Text File  |  1994-10-12  |  2.1 KB  |  134 lines

  1. #!./perl
  2.  
  3. # $RCSfile: write.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:38 $
  4.  
  5. print "1..3\n";
  6.  
  7. format OUT =
  8. the quick brown @<<
  9. $fox
  10. jumped
  11. @*
  12. $multiline
  13. ^<<<<<<<<<
  14. $foo
  15. ^<<<<<<<<<
  16. $foo
  17. ^<<<<<<...
  18. $foo
  19. now @<<the@>>>> for all@|||||men to come @<<<<
  20. {
  21.     'i' . 's', "time\n", $good, 'to'
  22. }
  23. .
  24.  
  25. open(OUT, '>Op_write.tmp') || die "Can't create Op_write.tmp";
  26.  
  27. $fox = 'foxiness';
  28. $good = 'good';
  29. $multiline = "forescore\nand\nseven years\n";
  30. $foo = 'when in the course of human events it becomes necessary';
  31. write(OUT);
  32. close OUT;
  33.  
  34. $right =
  35. "the quick brown fox
  36. jumped
  37. forescore
  38. and
  39. seven years
  40. when in
  41. the course
  42. of huma...
  43. now is the time for all good men to come to\n";
  44.  
  45. if (`cat Op_write.tmp` eq $right)
  46.     { print "ok 1\n"; unlink 'Op_write.tmp'; }
  47. else
  48.     { print "not ok 1\n"; }
  49.  
  50. format OUT2 =
  51. the quick brown @<<
  52. $fox
  53. jumped
  54. @*
  55. $multiline
  56. ^<<<<<<<<< ~~
  57. $foo
  58. now @<<the@>>>> for all@|||||men to come @<<<<
  59. 'i' . 's', "time\n", $good, 'to'
  60. .
  61.  
  62. open OUT2, '>Op_write.tmp' or die "Can't create Op_write.tmp";
  63.  
  64. $fox = 'foxiness';
  65. $good = 'good';
  66. $multiline = "forescore\nand\nseven years\n";
  67. $foo = 'when in the course of human events it becomes necessary';
  68. write(OUT2);
  69. close OUT2;
  70.  
  71. $right =
  72. "the quick brown fox
  73. jumped
  74. forescore
  75. and
  76. seven years
  77. when in
  78. the course
  79. of human
  80. events it
  81. becomes
  82. necessary
  83. now is the time for all good men to come to\n";
  84.  
  85. if (`cat Op_write.tmp` eq $right)
  86.     { print "ok 2\n"; unlink 'Op_write.tmp'; }
  87. else
  88.     { print "not ok 2\n"; }
  89.  
  90. eval <<'EOFORMAT';
  91. format OUT2 =
  92. the brown quick @<<
  93. $fox
  94. jumped
  95. @*
  96. $multiline
  97. and
  98. ^<<<<<<<<< ~~
  99. $foo
  100. now @<<the@>>>> for all@|||||men to come @<<<<
  101. 'i' . 's', "time\n", $good, 'to'
  102. .
  103. EOFORMAT
  104.  
  105. open(OUT2, '>Op_write.tmp') || die "Can't create Op_write.tmp";
  106.  
  107. $fox = 'foxiness';
  108. $good = 'good';
  109. $multiline = "forescore\nand\nseven years\n";
  110. $foo = 'when in the course of human events it becomes necessary';
  111. write(OUT2);
  112. close OUT2;
  113.  
  114. $right =
  115. "the brown quick fox
  116. jumped
  117. forescore
  118. and
  119. seven years
  120. and
  121. when in
  122. the course
  123. of human
  124. events it
  125. becomes
  126. necessary
  127. now is the time for all good men to come to\n";
  128.  
  129. if (`cat Op_write.tmp` eq $right)
  130.     { print "ok 3\n"; unlink 'Op_write.tmp'; }
  131. else
  132.     { print "not ok 3\n"; }
  133.  
  134.